<script setup>
import emitter from '@/utils/bus';

function click(){
    emitter.emit('sendDataTo1',{msg:'来自组件2的消息'})
}

</script>

<template>

    <div>
        <h2>组件2</h2>
        <el-button @click="click">给组件1传递数据</el-button>
    </div>

</template>

<style scoped>

</style>
